<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/common.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../css/templet.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../fonts/font-awesome.min.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../mui/css/mui.css?01_38" />
		<link rel="stylesheet" type="text/css" href="../ali/iconfont.css?01_38" />
		<script type="text/javascript" src="../common/js/jquery.js?01_38"></script>
		<!--插件-->
		<script type="text/javascript" src="../common/js/vue.min.js?01_38"></script>
		<script type="text/javascript" src="../common/js/mui.min.js?01_38"></script>
		<script type="text/javascript" src="../common/js/common.js?01_38"></script>
		<script type="text/javascript" src="../common/js/fastclick.js?01_38"></script>
		<script type="text/javascript" src="../common/js/main.js?01_38"></script>
		<script type="text/javascript" src="../common/js/app.js?01_38"></script>
		<script type="text/javascript" src="../common/js/update.js"></script>
		<style>
			.sign {
				width: 80%;
				text-align: center;
				border-radius: 1px so;
				border: 1px solid #ccc;
				border-radius: 5px;
				margin: auto;
				margin-top: 40px;
				padding: 25px 0px;
				background: white;
			}
			
			.top {
				overflow: hidden;
			}
			
			.go {
				text-align: center;
				width: 100px;
				background: #fd5749;
				color: white;
				border-radius: 10px;
				padding: 10px 0px;
				margin: auto;
				margin-top: 10px;
			}
			
			.iconfont.icon-shezhi.f-20 {
				font-size: 20px;
			}
			
			.iconfont.icon-gongwenbao.f-20 {
				font-size: 20px;
			}
		</style>
	</head>

	<body>
		<div id="app" v-cloak>
			<div v-if="clock_v">
				<div v-if="wind_work=='1'" class="wrap_body  bg-grayf4 work">
					<!--上半部分-->
					<div class="top">
						<div v-if="work_show=='1'">
							<!--红色部分-->
							<div class="bg-red9 pad-l-10 pad-r-10 pad-t-15">

								<!--logo部分-->
								<div class="fiex fff  pad-b-15">
									<!--左边-->
									<div class="fiex1 fiex">
										<!--logo-->
										<div class="mag-r-15">
											<img v-if="my_msg.headimgurl_path.length!=0" :src="oss+my_msg.headimgurl_path+'?x-oss-process=image/resize,m_fill,limit_0,h_150,w_150'" class="logo_img" />
											<img v-else :src="con_img" class="logo_img" />
										</div>
										<!--店铺信息-->
										<div class="fiex1">
											<p class="f-20 f-b">{{my_msg.nickname}}</p>
											<p class="f-15 pad-t-5"><span>{{b_lg[1214]}}：</span><span>{{work_time}}</span></p>
										</div>
									</div>
									<!--右边下班部分-->
									<a @click="jum('../shop/offDuty.html')">
										<p class="center"><img src="../images/w/off_duty_white.png" class="off_duty_img" /></p>
										<p class="center pad-t-5 f-13 fff">{{b_lg[1215]}}</p>
									</a>
								</div>

								<!--顾客桌号部分-->
								<div>
									<!--有消息时-->
									<div class="info" v-if="msg_List.length>0">
										<div>

											<div v-for="(item,key,index) in msg_List" v-if="item.is_read == 1 && key<3">
												<!--客户端支付成功消息-->
												<div @click="checkOrder_look(item.type,item)" class="list table btn_c">
													<dl class="cf">
														<dt class="fl f-15 f-b"><span class="red9 mag-r-5">{{item.table_name}}</span><span>{{b_lg['1341']}}</span></dt>
														<dd class="fr"><span class="clock pr"></span><span>{{item.time}}</span></dd>
													</dl>
													<p class="mag-t-10 f-15 cf ">
														<span class="mag-r-5" v-if="item.type == 1">{{b_lg['1342']}}</span>
														<span class="mag-r-5" v-else-if="item.type == 2">{{b_lg['1343']}}</span>
														<span class="mag-r-5" v-else-if="item.type == 3">{{b_lg['1344']}}</span>
														<a class="fr red9 center f-13" v-if="item.type == 1">{{b_lg['1233']}}</a>
														<a class="fr red9 do_it pad-l-15 pad-r-15 center f-13" v-else>{{b_lg['1345']}}</a>
													</p>
												</div>
												<div class="bank5"></div>
											</div>

										</div>

										<!--下拉按钮部分-->
										<div class="center mag-t-15 pad-b-15" @click="jum('workRecord.html')" v-if="messageNum>3">
											<a class="pad-t-5 pad-b-5 bk pad-l-100 pad-r-100 bg-fff red9 more_info">
												<span>{{messageNum}}</span><span>{{b_lg['1339']}}</span>
											</a>
										</div>
									</div>

									<!--无消息时-->
									<div class="no_info" v-else>
										<div class="f-15 center bg-fff pad-b-20">
											<p class="bg"></p>
											<p>{{b_lg[1216]}}</p>
										</div>
										<div class="bank15"></div>
									</div>
								</div>

							</div>
							<div class="bank10"></div>
							<!--菜谱部分-->
							<div class="bottom center">

								<!--收款码部分-->
								<div class="cf bg-fff pay_code">
									<div class="fl my_table">
										<a href="javascript:;" @click="cli_jum">
											<dl v-if="msg" class="fiex pad-r-12 btn_c">
												<dt class="col-sm-6 cf pad-l-20  pad-t-30 pad-b-30">
													<div class="fl"><img src="../images/w/opt_04.png" class="pr"/></div>
													<div class="oh pad-l-5 pad-r-5">
														<p class="f-15 c000">{{b_lg[1217]}}</p>
														<p class="f-13 c999">{{b_lg[1218]}}/{{b_lg[1219]}}</p>
													</div>
												</dt>
												<dd class="fiex1 f-left col-sm-6 cf">
													<div class="fl  center col-sm-6 pad-t-30 pad-b-30">
														<p class="red9">{{home_smg.shop_table_used_count}}</p>
														<p class="f-13 pad-l-2 pad-r-2">{{b_lg[1220]}}</p>
													</div>
													<div class="center oh pad-t-30 pad-b-30">
														<p class="c999">{{home_smg.shop_table_null_count}}</p>
														<p class="f-13 pad-l-2 pad-r-2">{{b_lg[1221]}}</p>
													</div>
												</dd>

											</dl>
										</a>
									</div>

									<!--排队-->
									<div class="item fl pr" v-if="is_queue == 1">
										<span @click="queue_takeNumber">
										<p class="top">
											<img src="../images/w/opt_08.png" alt="" />
										</p>
										<p class="mag-t-15 text f-15 txt">{{b_lg[1406]}}</p>
										</span>
									</div>
									<!--优惠券核销-->
									<div class="item fl">
										<span @click="jum('../coupon/discountCoupon.html')">
											<p class="top"><img src="../images/w/opt_06.png" /></p>
											<p class="mag-t-15 text f-15 txt">{{b_lg[1224]}}</p>
										</span>
									</div>
									<!--会员卡-->
									<div class="item fl">
										<span @click="jum('../vip/vipCardSearch.html')">
											<!--<p class="red9 top f-18">{{member_card_count}}</p>-->
											<p class="top"><img src="../images/w/opt_07.png" /></p>
											<p class="mag-t-15 text f-15 txt">{{b_lg[1069]}}</p>
										</span>
									</div>
									<!--考勤记录-->
									<div class="item fl line">
										<span @click="jum('../shop/attendanceRecord.html')">
											<p class="top"><img src="../images/w/opt_02.png" /></p>
											<p class="mag-t-15 text f-15 txt">{{b_lg[1225]}}</p>
										</span>
									</div>
									<!--工作记录-->
									<div class="item fl pr">
										<span @click="jum('workRecord.html')">
											<span class="bg-red9 fff pa point f-12" v-if="messageNum>0">{{messageNum}}</span>
										<p class="top">
											<img src="../images/w/opt_05.png" alt="" />
										</p>
										<p class="mag-t-15 text f-15 txt">{{b_lg[1338]}}</p>
										</span>
									</div>

									<!--预约-->
									<div class="item fl pr">
										<span @click="details_order">
										<p class="top">
											<img src="../images/order.png" alt="" />
										</p>
										<p class="mag-t-15 text f-15 txt">{{b_lg[1407]}}</p>
										</span>
									</div>
									<!--管理-->
									<div @click="admin_btn" class="item fl pr">
										<span>
										<p class="top">
											<img src="../images/w/opt_09.png" alt="" />
										</p>
										<p class="mag-t-15 text f-15 txt">{{b_lg[1061]}}</p>
										</span>
									</div>
								</div>

								<div class="bank10"></div>

								<!--广告栏部分-->
								<div class="mag-b-40">
									<div v-if="app.home_smg.banner.adv">
										<div v-for="(v,k) in app.home_smg.banner.list" class=" pad-10 bg-fff mag-b-10" @click="jum_page(v)">
											<div style="width: 100%; overflow: hidden;">
												<img style="width: 100%;" :src="oss+v.thumb+'?x-oss-process=image/resize,m_fill,limit_0,h_223,w_700'" />
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>

						<div v-else>
							<div class="my_shop" style="overflow: hidden;" style="position: relative;">
								<div v-if="bind_shop!=0" class="fff f-20 pad-10 pad-r-20 pr" style="text-align: right;" @click="admin_btn"><span class="mag-r-10">{{b_lg[1061]}}</span><img src="../images/back.png" class="pa" style="transform:scaleX(-1);width: 10px; height: 20px;top: 15px; right: 12px;" /> </div>
								<div v-if="bind_shop==1" class="content">
									<div class="item scan_work bg-fff  mag-t-30 pad-l-15 pad-r-15  pad-b-20 p-b-60" style="position: absolute; top: 50%; margin-top: -50%; width: auto; height: auto; padding: 10px; box-sizing: border-box; margin: -60% 10px;">
										<dl class="fiex"><dt class="mag-r-15"><img id="image" src="http://foodievc.oss-ap-southeast-1.aliyuncs.com/Public/Upload/image/20170914/59ba4a9c6939b.jpg" class="icon"></dt>
											<dd class="fiex1 pad-t-5 fiex">
												<div class="fiex5 pad-r-10">
													<p class="f-18 f-b">Ichi Zen Japanese Restaurant</p>
													<p class="f-13 ellipsis-2">1, JALAN CAMAR 1/1, TAMAN PERLING, JOHOR BAHRU, JALAN CAMAR 1, TAMAN PERLING, 81200 SKUDAI,JOHOR</p>
												</div>
												<div class="red9 f-13 fiex1" @click="leaveshop">{{b_lg['1241']}}</div>
											</dd>
										</dl>
										<div class="pad-t-20">
											<div v-if="is_open_scan_work == 1">
												<a class="bk center red9 f-15 mag-t-35 mag-b-25 btn btn_red pad-t-15 pad-b-15" @click="scan_work">{{b_lg[1242]}}</a>
											</div>
											<!--点击按钮上班-->
											<div v-else-if="is_open_scan_work == 0">
												<a class="bk bg-red9 fff btn_red btn pad-l-50 pad-r-50 pad-t-15 pad-b-15 center btn" @click="startWork">{{b_lg[1243]}}</a>

											</div>
											<p class="mag-t-15">
												<a class="bk blue btn pad-l-50 pad-r-50 pad-t-15 pad-b-15 center record_btn" @click="jum('../shop/attendanceRecord.html?page=index')">{{b_lg['1225']}}</a>
											</p>

										</div>
									</div>
								</div>

								<div v-else-if="bind_shop==0" class="without_shop">
									<div class="fff f-20 pad-10 pad-r-20 pr" style="text-align: right;" @click="admin_btn"><span class="mag-r-10">{{b_lg[1061]}}</span><img src="../images/back.png" class="pa" style="transform:scaleX(-1);width: 10px; height: 20px;top: 15px; right: 12px;" /> </div>
									<div class="bg-fff pad-l-15 pad-r-15 pad-t-30 pad-b-40 text  mag-10 mag-b-30 hide" id="bind-shop">
										<div class="center">
											<h2>{{b_lg['1247']}}</h2>
											<h4 class="red9 pad-t-15">{{b_lg['1248']}}</h4>
											<div class="line-ccc"></div>
											<div class="f-15">{{b_lg['1249']}}</div>
										</div>
										<div class="bg-fff fiex pad-r-20 search mag-b-30 mag-t-20" style="box-shadow: 0px 0px 5px #ddd;">
											<div class="fiex1"><input type="search" v-model="numbercode" :placeholder="b_lg['1222']" class="pad-t-15 pad-b-15 pad-l-12 pad-r-12 bk col-sm-11 f-24"></div>
											<div class="pad-l-5">
												<div @click="bindShop" class="scan" style="width: 33px;height: 30px;background-image: url(../images/coupon/scan.png);background-size: cover;"></div>
											</div>
										</div>
										<div class="center pad-t-20 pad-b-10">
											<a @click="bind()" class="bg-red9 fff pad-l-70 pad-r-70 pad-t-15 pad-b-15 btn f-16">{{b_lg['1118']}}</a>
										</div>
										<div>
											<div class="item cf" style="width: auto; border: 0; height: auto; margin: 30px 0; padding: 0;">
												<div class="number fl f-15">1</div>
												<div class="mag-l-35 c666">{{b_lg['1250']}}</div>
											</div>
											<div class="item cf" style="width: auto; border: 0; height: auto; margin: 30px 0; padding: 0;">
												<div class="number fl f-15">2</div>
												<p class="mag-l-35 c666">{{b_lg['1251']}}</p>
											</div>
											<div class="item cf" style="width: auto; border: 0; height: auto; margin: 30px 0; padding: 0;">
												<div class="number fl f-15">3</div>
												<p class="mag-l-35 c666">{{b_lg['1252']}}</p>
											</div>
										</div>
									</div>
									<div class="bank30"></div>
								</div>
								<div v-else-if="bind_shop==2" class="audit content">
									<div class="item bg-fff  mag-t-30 pad-l-15 pad-r-15 pad-t-20 pad-b-20 mag-10" style="width: auto; height: auto; padding: 15px;">
										<dl class="fiex"><dt class="mag-r-15"><img id="image" src="http://foodievc.oss-ap-southeast-1.aliyuncs.com/Public/Upload/image/20170914/59ba4a9c6939b.jpg" class="icon"></dt>
											<dd class="pad-t-5 fiex1">
												<p class="f-18 f-b">Ichi Zen Japanese Restaurant</p>
												<p class="f-13 ellipsis-2"></p>
											</dd>
										</dl>
										<div class="center"><img src="../images/default_graph/wait.png" class="clock"></div>
										<div class="center f-13">{{b_lg['1348']}}……</div>
										<p class="mag-t-10 reapply">
											<a @click="reapply()" class="fff btn btn_red pad-l-30 pad-r-30 pad-t-15 pad-b-15 f-15 bk center bg-red9">{{b_lg['1240']}}</a>
										</p>
									</div>
								</div>
							</div>
						</div>
						<!--扫码部分-->
						<div class="scan_pop fff hide">
							<div class="pop_wrap pr center">
								<div class="fl pa pop_item pop_item_01 bg-red9 pad-t-5" @click="coupon">
									<div class="bg bg_01"></div>
									<div class="text">{{b_lg['1111']}}</div>
								</div>
								<div class="fl pa pop_item pop_item_02 bg-red9 pad-t-5" @click="vip">
									<div class="bg bg_02"></div>
									<div class="text">{{b_lg['1069']}}</div>
								</div>
								<div class="fl pa pop_item pop_item_03 bg-red9 pad-t-5" @click="table">
									<div class="bg bg_03"></div>
									<div class="text">{{b_lg['1217']}}</div>
								</div>
								<div class="fl pa pop_item pop_item_04 bg-red9 pad-t-5" @click="shop">
									<div class="bg bg_04"></div>
									<div class="text">{{b_lg['1222']}}</div>
								</div>
							</div>

						</div>
					</div>
				</div>
				<div v-else class="wrap_body  bg-grayf4 manage">
					<div class="main">
						<div class="mbg pad-t-45">
							<div class="fff">
								<header>
									<div class="back pad-10 pr">
										<a @click="word_btn"></a>
									</div>
								</header>
							</div>
							<div class="center fff">
								<p>
									<img :src="oss+my_msg.headimgurl_path+'?x-oss-process=image/resize,m_fill,limit_0,h_158,w_158'" class="icon" v-if="my_msg.headimgurl_path!=''&&my_msg.headimgurl_path!=undefined" />
									<img :src="con_img" class="icon" onerror="lod(this)" v-else/>
								</p>
								<p class="mag-t-10 f-20 f-b">{{my_msg.nickname}}</p>
							</div>
						</div>

						<div class="mag-t-5">
							<div @click="pag_j('../manage/accountSetting.html')" class="item bg-fff btn_c">
								<a href="javascript:;">
									<dl class="pad-l-25 pad-r-25 pad-t-20 pad-b-20 cf">
										<dt class="col-sm-10 f-15">
											<div class="bg bg_01 fl mag-r-20"></div>
											<div class="mag-t-2">{{b_lg[1209]}}</div>
										</dt>
										<dd class="fr mag-t-5">
											<a href="javascript:;" class=" bg_r bk"></a>
										</dd>
									</dl>
								</a>
							</div>
							<div class="bank5"></div>

							<div @click="pag_j('../shop/myShop.html?leave=admin')" class="item bg-fff btn_c">
								<a href="javascript:;">
									<dl class="pad-l-25 pad-r-25 pad-t-20 pad-b-20 cf">
										<dt class="col-sm-9 f-15">
											<div class="bg bg_02 fl mag-r-20"></div>
											<div class="mag-t-2">{{b_lg[1210]}}</div>
										</dt>
										<dd class="fr mag-t-5">
											<a href="javascript:;" class=" bg_r bk"></a>
										</dd>
									</dl>
								</a>
							</div>
							<div class="bank5"></div>
							<!--语音-->
							<div @click="jum('../manage/languageSetting.html');" class="item bg-fff btn_c">
								<a>
									<dl class="pad-l-25 pad-r-25 pad-t-20 pad-b-20 cf">
										<dt class="col-sm-8 f-15">
											<div class="bg bg_04 fl mag-r-20"></div>
											<div class="mag-t-2">{{b_lg[1073]}}</div>
										</dt>
										<dd class="fr c666 fiex">
											<span class="pr mag-r-15" style="top:4px;">{{lag}}</span>
											<a class="fr bg_r mag-t-5 mag-l-5 bk"></a>
										</dd>
									</dl>
								</a>
							</div>
							<div class="bank5"></div>
							<!--关于我们-->
							<div @click="jum('../manage/aboutUs.html')" class="item bg-fff btn_c">
								<a>
									<dl class="pad-l-25 pad-r-25 pad-t-20 pad-b-20 cf">
										<dt class="col-sm-9 f-15">
											<div class="bg bg_06 fl mag-r-20"></div>
											<div class="mag-t-2">{{b_lg[1372]}}</div>
										</dt>
										<dd class="fr c666">
											<a class="fr bg_r mag-t-5 mag-l-5 bk"></a>
										</dd>
									</dl>
								</a>
							</div>
							<div class="bank5"></div>
							<!--意见反馈-->
							<div @click="jum('../manage/feedback.html')" class="item bg-fff btn_c">
								<a>
									<dl class="pad-l-25 pad-r-25 pad-t-20 pad-b-20 cf">
										<dt class="col-sm-9 f-15">
											<div class="bg bg_07 fl mag-r-20"></div>
											<div class="mag-t-2">{{b_lg[1269]}}</div>
										</dt>
										<dd class="fr c666">
											<a class="fr bg_r mag-t-5 mag-l-5 bk"></a>
										</dd>
									</dl>
								</a>
							</div>
							<div class="bank5"></div>
						</div>
						<p class="center mag-t-25">
							<a href="javascript:;" @click="ext_log()" class=" bg-aaa fff pad-l-40 pad-r-40 pad-t-10 pad-b-10 btn mag-t-15">{{b_lg[1213]}}</a>
						</p>
					</div>
					<div class="scan_pop fff hide">
						<div class="pop_wrap pr center">
							<div class="fl pa pop_item pop_item_01 bg-red9 pad-t-5" @click="coupon">
								<div class="bg bg_01"></div>
								<div class="text">{{b_lg['1111']}}</div>
							</div>
							<div class="fl pa pop_item pop_item_02 bg-red9 pad-t-5" @click="vip">
								<div class="bg bg_02"></div>
								<div class="text">{{b_lg['1069']}}</div>
							</div>
							<div class="fl pa pop_item pop_item_03 bg-red9 pad-t-5" @click="table">
								<div class="bg bg_03"></div>
								<div class="text">{{b_lg['1217']}}</div>
							</div>
							<div class="fl pa pop_item pop_item_04 bg-red9 pad-t-5" @click="shop">
								<div class="bg bg_04"></div>
								<div class="text">{{b_lg['1222']}}</div>
							</div>
						</div>

					</div>
				</div>
			</div>
			<!--接口未加载完成界面-->
			<div v-else>
				<div class="mask bg-000 pa loading">
					<div class="pad-l-40 pad-r-40 pad-t-200">
						<div class="bg-fff wrap pr center ">
							<img src="../images/default_graph/animation.gif" />
						</div>
					</div>
				</div>
			</div>
		</div>
		<script>
			function plusReady() {}
			if(window.plus) {
				plusReady();
			} else {
				document.addEventListener('plusready', plusReady, false);
			}
			//检测登陆状态
			var app = null
			var pag = ""
			var flag = false; //是否弹出
			var socket_start = "1" //socket状态
			var messageJson = {
				'msg': []
			};

			function back_index() {
				app.numbercode = localStorage.getItem("shopSn")
				app.bind()
			}

			function refresh() {
				app.init()
			}

			function bank_btn(e) {
				// app.init()
				if(e == "2") {
					setTimeout(function() {
						app.admin_btn()
					}, 300)
				} else {
					setTimeout(function() {
						app.word_btn()
					}, 300)
				}
			}

			function admin_btn(e) {
				app.init()
				setTimeout(function() {
					app.admin_btn()
				}, 300)
			}
			//调用消息列表
			function message() {
				common_ajax(1, {
					page: 0,
					pagesize: 1000000
				}, "get_message_list", function(res) {
					if(res.status == 1) {
						messageJson.msg = res.result.list;
						connect(); //链接WebSocket//李
						app.freshindex();
					}
				})
			}
			//工作记录页面调用
			function wordMessage() {
				common_ajax(1, {
					page: 0,
					pagesize: 1000000,
					is_read: 1,
				}, "get_message_list", function(res) {
					if(res.status == 1) {
						messageJson.msg = res.result.list;
						app.freshindex();
					}
				})
			}

			var get_table_deail;

			function fun1() {
				
         		//设置系统版本号
                setItem("root","005")
				if(isAPP) {
					//屏蔽返回键
					And_back("no")
					ws = plus.webview.currentWebview();
					ws.setStyle({
						'popGesture': 'none'
					});
					var myDate = ""
					//判断在后台运行的时间决定是否重启APP
					document.addEventListener("pause", function() {
						myDate = (new Date()).valueOf();
					}, false);
					document.addEventListener("resume", function() {
						var myDate_2 = (new Date()).valueOf();
						if(myDate_2 - myDate >= 1800000) {
							plus.runtime.restart() //重启app
						}
					}, false);
				}
				down_load(); //下拉刷新开启
				var first_login = getItem("first_login"),
					get_table_deail = JSON.parse(getItem("table_deail"));
				if(getItem("get_shop_table_order_info")) {
					var cli_member_id = JSON.parse(getItem("get_shop_table_order_info")).order_info.member_id
				}
				//				if(getItem("shiyixia") != null) {
				//					messageJson.msg = JSON.parse(getItem("shiyixia"));
				//				}
				var log = getItem("login_sta")
				if(log != "1") {
					jum("../login/login.html?2")
				}
				app = new Vue({
					el: '#app',
					data: {
						url: con_img, //默认图片
						my_msg: {},
						numbercode: "", //绑定店铺所输入的店铺码
						bind_shop: "0", //服务员绑定店铺状态 0:未绑定 1:已绑定 2:绑定申请
						work_time: '00:00:00', //工作时间
						ret_data: {},
						c_time: "", //员工打卡时间
						home_smg: "",
						now_time: "", //系统当前时间
						b_lg: global_lange, //语言包
						headimgurl_path: con_img, //默认图片
						my_name: "", //昵称
						lag: global_lange_config[getItem('lg')].name, //已经选择的语言
						cla: "work",
						wind_work: "1",
						clock_v: false, //接口是否加载完成
						msg: false, //消息 开桌是否显示
						work_show: 2,
						hint: "请前往我的店铺进行签到",
						waiter_status: "",
						leave: "前往",
						coupon_uesd_count: "", //今日优惠券核销数量
						member_card_count: "", //会员卡数量
						messageNum: 0, //李
						msg_List: [], //李
						arr: [],
						time: new Date().getTime(),
						num: 0,
						is_queue: "",
						first_login: getItem("first_login"),
						is_open_scan_work: "" //是否扫码上班
					},
					mounted: function() {
						this.init();
					},
					methods: {
						queue_takeNumber: function() {
							var mm = JSON.parse(getItem("shop_table_cookbook"))
							var start = mm.rule_list_buy[85]
							if(start == 0) {
								mui.alert(app.b_lg[1500], app.b_lg[1320], app.b_lg[1190])
							} else {
								clicked("../queue/queue_takeNumber.html")
							}
						},
						details_order: function() {
							var mm = JSON.parse(getItem("shop_table_cookbook"))
							var start = mm.rule_list_buy[84]
							if(start == 0) {
								mui.alert(app.b_lg[1500], app.b_lg[1320], app.b_lg[1190])
							} else {
								clicked("../order/details_order.html")
							}
						},
						footer_alter: function() {
							mui.toast(app.b_lg['1370'])
						},
						cli_jum: function() { //点击跳转提前缓存菜谱
							jum("tableStatus.html");
						},
						ext_log: function() {

							var btnArray = [app.b_lg['1049'], app.b_lg['1190']]
							mui.confirm(app.b_lg['1058'], app.b_lg['1320'], btnArray, function(e) {
								if(e.index == 1) {
									//退出登录清除重置状态
									setItem("login_sta", "0");
									//跳转到登陆页面
									global_signout(); //退出登录
									if(navigator.userAgent.match(/Html5Plus/i)) {
										plus.runtime.restart() //重启app
									} else {
										clicked("../work/workbench.html")
									}
								}
							}, "div")

						},
						//管理按钮
						admin_btn: function() {
							pag = 2 //判断是工作台页面还是管理员页面用于刷新按钮使用
							this.wind_work = 0
							this.init_admin()
							//							$(document).scrollTop(0);
						},
						//工作台按钮
						word_btn: function() {
							this.wind_work = 1
							app.work_show = 0
							switch(app.waiter_status) {
								case '4':
									$("#bind-shop").removeClass("hide")
									app.bind_shop = 0
									break;
								case '3':
									$("#bind-shop").removeClass("hide")
									app.bind_shop = 0
									break;
								case '2':
									app.bind_shop = 2
									break;
								case '1':
									app.bind_shop = 1
									break;
							}
							if(app.waiter_status == 1 && app.home_smg.check_work.status == 1) {
								app.work_show = 1;
							} else {
								app.work_show = 0
							}
							pag = 1 //判断是工作台页面还是管理员页面用于刷新按钮使用
						},
						noticeMsg: function() { //通知消息更新
							common_ajax("1", {
								page: 1,
								pagesize: 99999,
								is_read: 1,
							}, "get_message_list", function(e) {
								if(e.list) {
									app.messageNum = 0;
									app.msg_List = [];
									$.each(e.list, function(i, v) {
										if(v.is_read == 1) {
											app.msg_List.unshift(v);
											app.messageNum++;
										}
									});
								}

							})
						},
						//更新首页
						freshindex: function() { //李
							if(messageJson.msg) {
								app.messageNum = 0;
								app.msg_List = [];
								$.each(messageJson.msg, function(i, v) {
									if(v.is_read == 1) {
										app.msg_List.unshift(v);
										app.messageNum++;
									}
								});
							}
							//数据
							//							setItem("msg_list", JSON.stringify(messageJson.msg));

						},
						//页面跳转
						pag_j: function(h) {
							jum(h);
						},
						init: function() { //工作台界面
							var th = this;
							var shop_table_cookbook = {}
							var jso_tab = {}
							var food = {}
							var spec = {}
							var garnish = {}
							var detail = {}
							var taste = {}
							//餐桌
							var a = JSON.parse(getItem("my_msg"))

							common_ajax("1", {}, "get_home", function(h) {
								if(h.result.waiter_status == 1) {
									app.is_open_scan_work = h.result.shop_info.is_open_scan_work;
									console.log(app.is_open_scan_work)
									setItem("pageflag", 1);
								}
								if(h.result.waiter_status == 3) {
									app.clock_v = true //关闭加载动画
									app.work_show = 0 //默认将工作台页面关闭
									common_ajax("1", {}, "get_home", function(h) {
										app.waiter_status = h.result.waiter_status
										switch(app.waiter_status) {
											case '4':
												$("#bind-shop").removeClass("hide")
												app.bind_shop = 0
												break;
											case '2':
												app.bind_shop = 2
												break;
											case '3':
												$("#bind-shop").removeClass("hide")
												app.bind_shop = 0
												break;
											case '1':
												app.bind_shop = 1
												break;
											default:
												break;
										}
									})

									app.b_lg = JSON.parse(getItem("Langues"))
									app.lag = global_lange_config[getItem('lg')].name
									return
								} else {
									var b = JSON.parse(getItem("my_msg"))
									b.shop_id = h.result.shop_id
									b.waiter_status = h.result.waiter_status
									aa()
								}
							})

							function aa() {
								common_ajax("1", {}, "init_shop_info", function(h2) {
									var shop_table_cookbook = h2.result,
										period_obj = {}, //用于匹配用餐时长时使用;
										start = 0; //用于检测(餐桌)缓存是否存在如果不存在执行加载方法
									app.is_queue = h2.result.queue_set.is_queue;
									//提取出用餐时长
									$.each(shop_table_cookbook.shop_table_cate_list, function(k, v) {
										period_obj[v.id] = v
									});
									//end
									if(h2.status != 1) { //判断接口是否调用成功
										mui.toast(h2.msg);
										return;
									}
									var login = getItem("login_sta")
									if(login != 1) {
										jum("../login/login.html?1")
									}

									lang(getItem("lg"), function(h) {
										global_lange = h;
										th.b_lg = ""
										th.b_lg = global_lange
									}, "1")
									//
									setItem("shop_table_cookbook", JSON.stringify(h2.result));
									//备注
									setItem("beizhu_json", JSON.stringify(h2.result.beizhu));
									//是否容许多菜谱点餐
									setItem("is_more_cookbook", JSON.stringify(h2.result.is_more_cookbook));
									if(!getItem("table_deail") || !getItem("cookbook")) { //所需缓存被清除重新加载
										start = 1
									}
//									if(h2.result.shop_info.ver != getItem("shop_ver") || start == 1) { //更新版本
									if(1) { //更新版本
										//设置版本号
										setItem("shop_ver", h2.result.shop_info.ver);
										app.clock_v = false; //将加载动画开启
										global_json1("/shop_goods/", function(h4) {

											var package_list_obj = {};
											$.each(h4.result.package_list, function(k, v) {
												package_list_obj[v.id] = v
											});
											setItem("package_list", JSON.stringify(package_list_obj))
											console.log("shop_goods", h4)
											$.each(h4, function(k, v) {
												$.each(v.list, function(k1, v1) {
													$.each(v1.goods_list, function(k2, v2) {
														v2.part = {}
													});
												});
											});
											var food = {}
											$.each(h4.result.list, function(k, v) {
												$.each(v.goods_list, function(k_1, v_1) {
													food[v_1.id] = v_1;
												});
											});
											setItem("food", JSON.stringify(food))
											setItem("foods", JSON.stringify(h4.result.list)); //菜谱
											jso_tab = JSON.parse(getItem("table"));
											//从菜单中取出所有菜品
											$.each(h4.result.list, function(k, v) {
												if(v.goods_list) {
													$.each(v.goods_list, function(k_1, v_1) {
														food[v_1.id] = v_1;
													});
												}

											});
											//所有菜品
											setItem("all_food", JSON.stringify(food));
											//所有菜品规格
											$.each(h4.result.spec_list, function(k, v) {
												$.each(v, function(k_1, v_1) {
													spec[v.spec_id] = v_1;
												});
											});
											setItem("all_spec", JSON.stringify(spec));
											//所有菜品配菜
											$.each(h4.result.garnish_list, function(k, v) {
												$.each(v, function(k_1, v_1) {
													garnish[v.garnish_id] = v_1;
												});
											});
											//所有菜品口味
											$.each(h4.result.taste_list, function(k, v) {
												$.each(v, function(k_1, v_1) {
													taste[v.taste_id] = v_1;
												});
											});
											setItem("all_taste", JSON.stringify(taste));
											setItem("all_garnish", JSON.stringify(garnish));
											//菜谱详细信息
											$.each(shop_table_cookbook.cookbook_list, function(k, v) {
												detail[v.id] = v;
											});
											//缓存菜谱
											setItem("cookbook", JSON.stringify(detail));
											//缓存餐桌
											global_json1("/shop_table/", function(h3) {
												if(h3 == 3) {
													th.clock_v = true
													return
												}
												var a = {}, //a缓存餐桌的存储对象
													b = {}, //缓存餐桌对象
													table_deail = h3.result.list, //存储餐桌返回结果
													jso_tab_id = {}; //建立餐桌对象
												$.each(h3.result.list, function(k, v) {
													$.each(v.list, function(k_1, v_1) {
														v_1.nth = k_1
													});
													a[v.id] = v
												});
												$.each(table_deail, function(k, v) {
													$.each(v.list, function(k_2, v_2) {
														b[v_2.id] = v_2
													});
												});
												$.each(a, function(i, v) {
													v.num = 0;
													$.each(v.list, function(i_1, v_1) {
														jso_tab_id[v_1.id] = {
															o: i,
															i: i_1
														};
													});
													$.each(v.list, function(i_1, v_1) { //为每一个餐桌添加用餐时长
														v_1['period'] = period_obj[v_1.table_cate_id].period
													});
												});
												setItem("jso_tab_id", JSON.stringify(jso_tab_id)) //缓存餐桌(这里将餐桌进行分区,用于点餐桌面使用)
												setItem("table", JSON.stringify(a)) //缓存餐桌(直接缓存餐桌的列表没做处理)
												setItem("table_deail", JSON.stringify(b)) //缓存餐桌(将id提取出来)
											})
											app.clock_v = true; //将加载动画关闭
											getAvatar(); //获取头像
										})
									} else {
										getAvatar() //获取头像
									}
									//语言包
									app.b_lg = JSON.parse(getItem("Langues"))
									app.lag = global_lange_config[getItem('lg')].name

									function getAvatar() { //获取头像
										//获取服务员信息(头像...)
										common_ajax("1", {}, "get_waiter_info", function(h) {
											app.my_msg = h.result;
											//获取当前店铺信息
											//重置缓存中的头像信息
											console.log("h.result11", h.result)
											var waiter = JSON.parse(getItem("my_msg"))
											waiter.headimgurl = app.my_msg.headimgurl
											waiter.headimgurl_path = app.my_msg.headimgurl_path
											waiter.nickname = app.my_msg.nickname
											setItem("my_msg", JSON.stringify(waiter))
											common_ajax("1", {}, "get_home", function(h) {
												app.waiter_status = h.result.waiter_status
												app.coupon_uesd_count = h.result.coupon_uesd_count //优惠券核销数量
												app.member_card_count = h.result.member_card_count //会员卡数量
												app.work_show = 0 //默认将工作台页面关闭
												switch(app.waiter_status) {
													case '4':
														app.bind_shop = 0
														break;
													case '2':
														app.bind_shop = 2
														break;
													case '3':
														app.bind_shop = 0
														break;
													case '1':
														app.bind_shop = 1
														break;
												}
												if(h.result.shop_from == 2) {
													app.msg = false
												} else {
													app.msg = true
												}

												if(h.result.check_work == "" || h.result.check_work == undefined || h.result.check_work == 0) {
													app.clock_v = true;
													return
												}
												app.home_smg = h.result;
												if(app.waiter_status == 1 && app.home_smg.check_work.status == 1) {
													if(isAPP) {
														plus.push.setAutoNotification(true);
													}
													if(socket_start == 1) {
														message();
														socket_start = 0
													}
													app.work_show = 1

												} else {
													if(isAPP) {
														plus.push.setAutoNotification(false);
													}
													app.work_show = 0
												}
												if(!app.home_smg.shop_table_used_count) {
													app.home_smg.shop_table_used_count = 0
												}

												if(h.result.check_work.status == 1) {
													app.c_time = h.result.check_work.addtime
													app.now_time = h.result.time;
												}
												app.work_time = ti(app.c_time);
//												setInterval(function() {
//													app.now_time
//													common_ajax("1", {}, "get_home", function(h) {
//														app.now_time = h.result.time;
//														app.work_time = ti(h.result.check_work.addtime);
//														forms.auth = getItem("encode");
//													})

//												}, 60000);
												setTimeout(function() {
													app.noticeMsg();
													app.clock_v = true; //将加载动画关闭
												}, 500)

												if(isAPP) {
													var forms = {};
													var info_plus = plus.push.getClientInfo();
													if(info_plus.clientid == null) {
														forms.gpush_clientid = ""
													} else {
														forms.gpush_clientid = info_plus.clientid
													}
													if(info_plus.token == null) {
														forms.gpush_token = ""
													} else {
														forms.gpush_token = info_plus.token
													}
													if(isAPP) {
														forms.uuid = getItem("uuid");
													} else {
														forms.uuid = "866982030752101,866982030752119"
													}
												}

											});

										});

									}

								}) //获取菜谱信息
							}

						},
						time_data:function(){
								app.work_time = ti();
						},
						//扫码上下班
						scan_work: function() {
							//跳转到扫码页
							setTimeout(function() {
								clicked('../qrcode/qrscan.html?id=0&type=4&scan=0'); //上下班type=4
							}, 500)

						},
						init_admin: function() { //管理界面加载数据

						},
						work_time: function() { //计算工作时间
							setInterval(function() {
								app.work_time = ti(app.c_time);
							}, 60000);
						},
						table: function() {
							mui.toast(app.b_lg['1378'])
						},
						shop: function() {
							if(app.waiter_status == 2) {
								mui.toast(app.b_lg['1379']);
							} else if(app.waiter_status == 3) {
								clicked("../shop/myShop.html？scan=1");
								$(".code").removeClass("aside-nav");
							} else {
								mui.toast(app.b_lg['1380'])
							}

						},
						coupon: function() {
							clicked("../coupon/discountCoupon.html?scan=1");
							$(".code").removeClass("aside-nav");
						},
						vip: function() {
							clicked('../vip/vipCardSearch.html?scan=1');
							$(".code").removeClass("aside-nav");
						},
						add: function(ele) {
							var arr = $(ele.currentTarget);
							var flag = arr.hasClass("aside-nav");

							var u = navigator.userAgent; //根据手机版本号判断使用c3属性还是用jq实现
							if(u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { //安卓手机
								var u_num = u.substr(28, 1);
								if(u_num > 4) {
									if(flag) {
										arr.removeClass("aside-nav");
									} else {
										arr.addClass("aside-nav");
									}
								} else {
									var index = $(".scan_pop").attr("class").indexOf("hide");
									if(index > 0) {
										setTimeout(function() {
											$(".scan_pop").removeClass("hide");
										}, 300)
									} else {
										setTimeout(function() {
											$(".scan_pop").addClass("hide");
										}, 300)

									}
								}
								// window.location.href = "mobile/index.html";
							} else if(u.indexOf('iPhone') > -1) { //苹果手机
								// window.location.href = "mobile/index.html";
								if(flag) {
									arr.removeClass("aside-nav");
								} else {
									arr.addClass("aside-nav");
								}
							} else if(u.indexOf('Windows Phone') > -1) { //winphone手机
								if(flag) {
									arr.removeClass("aside-nav");
								} else {
									arr.addClass("aside-nav");
								}
								// window.location.href = "mobile/index.html";
							}

						},
						clear_cache: function() {
							$.ajax({
								type: "get",
								dataType: "json",
								url: "../language/" + getItem("lg") + ".json",
								success: function(h) {
									setItem("Langues", JSON.stringify(h));
									mui.toast("缓存清理完成");
									getAppInfo()
								},
								error: function(e) {
									mui.alert("语言包加载错误");
									debugger
								}
							});
						},
						//处理
						dealWith: function(e, id, state) { //李
							if(e == 2) {
								common_ajax(1, {
									"shop_table_id": id
								}, "put_call_waiter_cancel", function(res) {})
							} else if(e == 3) {
								common_ajax(1, {
									"shop_table_id": id
								}, "put_call_waiter_cancel2", function(res) {})
							}
						},
						//查看订单
						checkOrder: function(id, num) { //李
							clicked("../set/changeOrder.html?type=2&leave=index&table=" + id);
						},
						checkOrder_look: function(type, a) {
							var btnArray2 = [app.b_lg[1049], app.b_lg[1008]];
							mui.confirm(app.b_lg[1371], app.b_lg[1050], btnArray2, function(ee) {
								if(ee.index == 1) {
									if(type == 1) {
										clicked("../set/changeOrder.html?type=2&leave=index&table=" + a.shop_table_id);
									} else {
										app.dealWith(a.type, a.shop_table_id, a.is_read)
									}
								}
							}, "div")

						},
						//解绑店铺
						leaveshop: function() {
							//提示框
							var btnArray2 = [app.b_lg[1049], app.b_lg[1008]];
							mui.confirm(app.b_lg[1263], app.b_lg[1050], btnArray2, function(ee) {
								if(ee.index == 1) {
									//确定
									common_ajax(1, {}, "put_waiter_unbind_shop", function(res) {
										//判断数据是否请求成功
										if(res.status == 1) { //请求成功
											app.init()
											setTimeout(function() {
												app.word_btn()
											}, 600)
											//跳转到扫码页
											//										app.waiter_status = 3;//改变服务员状态
										} else { //请求失败
											mui.toast(res.msg);
										}
									})
								}
							}, "div")
						},
						//点击按钮上班开始计时
						startWork: function() {
							//提示框
							var btnArray2 = [app.b_lg[1049], app.b_lg[1008]];
							mui.confirm(app.b_lg[1264], app.b_lg[1050], btnArray2, function(ee) {
								if(ee.index == 1) {
									//确定
									common_ajax(1, {
										uuid: phone_uuid
									}, "put_work_sign_scan", function(res) {
										//判断数据是否请求成功
										if(res.status == 1) { //请求成功
											app.init()
											app.wind_work = 1
											app.work_show = true

										} else { //请求失败
											mui.toast(res.msg);
										}
									})
								} else {
									//取消
									app.init();
								}
							}, "div")
						},
						bind: function() { //绑定店铺
							//提示框
							if(app.numbercode == "") {
								mui.toast(app.b_lg[1382])
							} else if(app.numbercode.length != 8) {
								mui.toast(app.b_lg[1383])
							} else {
								var btnArray2 = [app.b_lg[1049], app.b_lg[1008]];
								mui.confirm(app.b_lg[1262], app.b_lg[1050], btnArray2, function(ee) {
									if(ee.index == 1) {
										//确定
										common_ajax(1, {
											shop_sn: app.numbercode
										}, "put_waiter_bind_shop", function(res) {
											if(res.status == 1) { //请求成功
												app.init()
												setTimeout(function() {
													app.word_btn()
												}, 600)
												// app.wind_work = 1
												// app.work_show = true
											} else {
												mui.toast(res.msg);
											}
											app.numbercode = "";
										})
									} else {
										//取消
										app.init();
									}
								}, "div")
							}
						},
						jum_page: function(v) {
							var position_id = app.home_smg.banner.position_id

							click_ajax({
								"position_id": position_id,
								"adv_id": v.adv_id,
								"member_id": cli_member_id
							}, function(h) {
								console.log(h)
							})
							//链接类型1纯图无链接,2App,3H5,4外链
							switch(v.type) {
								case "1":
									break;
								case "2":
									clicked("v");
									break;
								case "3":
									clicked("openview.html?src=" + v.url);
									break;
								case "4":
									plus.runtime.openURL(v.url);
									break;
								default:
									break;
							}
							if(v.type == 1) {

							}
						},
						//重新申请绑定店铺
						reapply: function() {

							//提示框
							var btnArray2 = [app.b_lg[1049], app.b_lg[1008]];
							mui.confirm(app.b_lg[1266], app.b_lg[1050], btnArray2, function(ee) {
								if(ee.index == 1) {
									//queding
									common_ajax(1, {
										uuid: phone_uuid
									}, "put_waiter_unbind_shop", function(res) {
										//判断数据是否请求成功
										if(res.status == 1) { //请求成功
											setTimeout(function() {
												clicked('../qrcode/qrscan.html?id=0&type=2'); //绑定店铺type=2
											}, 500)
										} else { //请求失败
											mui.toast(res.msg);
										}
									})
								} else {
									//取消
									app.init();
								}
							}, "div")
						},
						bindShop: function() {
							setTimeout(function() {
								clicked("../qrcode/qrscan.html?id=0&type=2");
							}, 500)
						}
					}
				})
				//取得时间
				function ti() { //打卡时候的时间
					//					var unixTimestamp = new Date((app.now_time - car_time) * 1000);

					var sec_to_time = function(s) {
						var t;
						if(s > -1) {
							var hour = Math.floor(s / 3600);
							var min = Math.floor(s / 60) % 60;
							if(hour < 10) {
								t = '0' + hour + ":";
							} else {
								t = hour + ":";
							}
							if(min < 10) {
								t += "0";
							}
							t += min;
						}
						return t;
					}
					var s = app.now_time - app.c_time
					return sec_to_time(s);
				}
				//执行一次
				if(navigator.userAgent.match(/Html5Plus/i)) {
					//				 plus.device.vibrate(1000);
					//				 plus.device.beep(1);
					setItem("uuid", plus.device.uuid)
					var info = plus.push.getClientInfo()
					setItem("gpush_clientid", info.clientid)
					setItem("gpush_token", info.token)
				} else {
					phone_uuid = "866982030752101,866982030752119"; //pc虚拟一个uuid方便测试
					setItem("uuid", phone_uuid)
				}
				//重置mui默认反返回键
				mui.back = function() {}
				//				And_back("index")
				//WebSocket
				var ws;
				var client_id;
				var connect_b = true;
				connect = function(v) {
					var htpwss = "ws://api-test.foodie.vc:7272/";
					if(connect_b == false) return false;
					var ws1 = new WebSocket(htpwss);
					// 服务端主动推送消息时会触发这里的onmessage
					ws1.onmessage = function(e) {
						//监听socket
						app.time_data() //刷新工作时间
						var memory_socket = JSON.parse(e.data)
						if(memory_socket.time){
							app.now_time = memory_socket.time; //记录当期时间(刷新工作时间使用)
							ti();
							setItem("now_time",memory_socket.time) //记录当前时间
						}
						console.log("eee", e)
						var data = eval("(" + e.data + ")");
						var type = data.type || '';
						switch(type) {
							case 'ping':
								ws1.send("{'type':'pong'}");
								break;
								// Events.php中返回的init类型的消息，将client_id发给后台进行uid绑定
							case 'init':
								client_id = data.client_id;
								//console.log(e.data);
								// 利用jquery发起ajax请求，将client_id发给后端进行uid绑定
								common_ajax(1, {
									"client_id": data.client_id
								}, "bind", function(e) {
									//                  setCookie("shopid",e.result.shop_id,30);
									setItem("shopid", e.result.shop_id)
									connect_b = false;
								});
								break;
							case 'waiter_by_put_order':
								//呼叫服务员
								socket_memmory(e)
								setmsg("waiter_by_put_order", data.data.shop_table_id)
								break;
							case 'put_call_waiter_cancel':
								//console.log("取消呼叫");
								socket_memmory(e)
								setmsg("put_call_waiter_cancel", data.data.shop_table_id)
								break;
							case 'put_call_waiter_cancel2':
								//console.log("取消呼叫买单");
								socket_memmory(e)
								setmsg("put_call_waiter_cancel2", data.data.shop_table_id)
								break;
							case 'waiter_by_put_order_2':
								//console.log("用户下单通知");
								socket_memmory(e)
								setmsg("waiter_by_put_order_2", data.data.shop_table_id);
								transferParameters(data.data.shop_table_id, "waiter_by_put_order_2");
								break;
							case 'waiter_by_put_call':
								//console.log("呼叫");
								socket_memmory(e)
								setmsg("waiter_by_put_call", data.data.shop_table_id);
								break;
							case 'waiter_by_put_call2':
								//console.log("呼叫买单");
								socket_memmory(e)
								setmsg("waiter_by_put_call2", data.data.shop_table_id)
								break;
							case 'put_order_goods_confirm':
								//console.log("订单下厨");
								transferParameters(data.data.shop_table_id, "put_order_goods_confirm");
								setmsg("put_order_goods_confirm", data.data.shop_table_id, data.data.member_id)
								break;
							case 'put_order_confirm':
								//console.log("结账");
								transferParameters(data.data.shop_table_id, "put_order_confirm");
								break;
							case 'put_order_info_table':
								//console.log("换桌");
								if(isAPP) {
									var tableurl = plus.webview.getWebviewById("tableStatus.html?" + root);
									if(tableurl) {

										setItem("huanzhuo", JSON.stringify({
											a: data.data.shop_table_id,
											b: data.data.shop_table_id_old
										}))
										tableurl.evalJS("back_table()");
									}
								}
								break;
							case 'js_ver_update': //系统更新通知
								//          	updatas(data.ver)
								break;
							case 'put_create_json':
								if(isAPP) {
									mui.alert(app.b_lg['1358'], app.b_lg['1320'], "OK", function() {
										setItem("shop_ver", -1000)
										plus.runtime.restart() //重启app
									})
								}
								break;
							case 'subscribe_update':
								setmsg('subscribe_update')
								break;
							case 'put_work_sign': //上下班
								setmsg('put_work_sign', "", "", "", data.data.type)
								break;
							case 'queue_refresh': //排队（过号，用餐，叫号，撤销）
								//						{data:{time: 1535703155, q_id: "2"},q_id:"2",time:1535703155,type:"queue_refresh"}传回来的数据
								setmsg('queue_refresh')
								break;
							case 'queue_stop': //停止排队
								//						{"type":"queue_stop","data":{"time":1536050898,"is_open":0}}传回来的数据
								setItem("webSocket_stopQueue", JSON.stringify(data));
								setmsg('queue_stop')
								break;
							case 'subscribe_info_msg':
								setmsg()
								break;
							default:
						}
					};

					ws1.onclose = function() {
						console.log("连接关闭，定时重连");
						connect_b = true;
						connect();
					};
					ws1.onerror = function() {
						console.log("WebSockets 出现错误!");
					};

				}
				var table_name;

				function socket_memmory(e) { //存储socket的信息 工作记录页面使用
					setItem("socketMsg", e.data)
				}

				function setmsg(type, id, old_id, member_id, data) {
					if(id) {
						table_name = get_table_deail[id].table_name;
					}
					switch(type) {
						case "waiter_by_put_call": //呼叫服务员
							messageJson.msg.push({
								"type": 2,
								"shop_table_id": id,
								"time": new Date().format("MM-dd hh:mm:ss"),
								"is_read": 1,
								"table_name": table_name
							});
							if(isAPP) {
								newsaudio.play();
								plus.device.vibrate(500);
							}
							break;
						case "waiter_by_put_call2": //呼叫买单
							messageJson.msg.push({
								"type": 3,
								"shop_table_id": id,
								"time": new Date().format("MM-dd hh:mm:ss"),
								"is_read": 1,
								"table_name": table_name
							});
							newsaudio.play();
							if(isAPP) {
								plus.device.vibrate(500); //震动
							}
							break;
						case "waiter_by_put_order_2": //用户下单通知
							messageJson.msg.push({
								"type": 1,
								"shop_table_id": id,
								"time": new Date().format("MM-dd hh:mm:ss"),
								"is_read": 1,
								"table_name": table_name
							});
							newsaudio.play();
							if(isAPP) {
								plus.device.vibrate(500);
							}
							break;
						case "put_order_confirm": //结账
							messageJson.msg.push({
								"type": 4,
								"shop_table_id": id,
								"time": new Date().format("MM-dd hh:mm:ss"),
								"is_read": 1,
								"table_name": table_name
							});
							break;
						case "put_order_info_table": //换桌
							messageJson.msg.push({
								"type": "put_order_info_table",
								"shop_table_id": id,
								"shop_table_id_old": old_id,
								"time": new Date().format("MM-dd hh:mm:ss"),
								"is_read": 1,
								"table_name": table_name
							});
							break;
						case "put_call_waiter_cancel": //取消呼叫服务员
							$.each(messageJson.msg, function(i, v) {
								if(v.type == 2) {
									if(v.shop_table_id == id) {
										v.is_read = 2;
										console.log("取消")
									}
								}
							});

							break;
						case "put_call_waiter_cancel2": //取消呼叫买单
							$.each(messageJson.msg, function(i, v) {
								if(v.type == 3) {
									if(v.shop_table_id == id) {
										v.is_read = 2;
									}
								}
							});
							break;
						case "put_order_goods_confirm": //订单下厨
							$.each(messageJson.msg, function(i, v) { //订单下厨
								if(v.type == 1) {
									if(v.shop_table_id == id) {
										v.is_read = 2;
									}
								}
							})
							break;
						case "put_work_sign": //上下班
							var tip = null;
							if(data == 1) {
								tip = app.b_lg['1506'];
							} else {
								tip = app.b_lg['1507'];
							}

							//确定
							if(isAPP) {
								//更新首页缓存数据
								//										var ws = plus.webview.getSecondWebview().id;
								var ws = null;
								$.each(plus.webview.all(), function(i, v) {
									if(v.id.indexOf("work/index.html") != -1) {
										ws = v.id;
									}
								});
								var btnArray3 = [app.b_lg['1008']];
								plus.webview.show(ws);
								//								mui.confirm(tip, app.b_lg['1320'], btnArray3, function(ee) {
								//									
								//								}, "div")
								mui.alert(app.b_lg['1320'], tip, btnArray3, function(e) {
									if(e.index == 0) {
										if(data == 2) {
											$.each(plus.webview.all(), function(k, v) {
												if(v.id.indexOf("work/index") != -1 || v.id.indexOf("index") != -1) {
													return true
												} else {
													plus.webview.close(v.id);
												}
											});
										}
										app.init();
									}
								}, "div")
							}

							break;
						case 'queue_refresh': //排队（过号，用餐，叫号，撤销）
							if(isAPP) {
								var queue_id = null;
								var queueDetail_id = null;
								var queueSet_id = null;
								$.each(plus.webview.all(), function(i, v) {
									if(v.id.indexOf("queue_details.html") > 0) {
										queueDetail_id = v.id;
									} else if(v.id.indexOf("queue_set.html") > 0) {
										queueSet_id = v.id;
									} else if(v.id.indexOf("queue_takeNumber.html") > 0) {
										queue_id = v.id;
									}
								});
								//更新排队首页缓存数据
								var queueurl = plus.webview.getWebviewById(queue_id);
								if(queueurl) {
									queueurl.evalJS("webSocketTn()");
								}
								//更新排队详情页缓存数据
								var queueDetailsurl = plus.webview.getWebviewById(queueDetail_id);
								if(queueDetailsurl) {
									queueDetailsurl.evalJS("webSocketDetails()");
								}
								//更新排队设置页缓存数据
								var queueSeturl = plus.webview.getWebviewById(queueSet_id);
								if(queueSeturl) {
									queueSeturl.evalJS("refresh()");
								}
							}
							break;
						case 'queue_stop': //停止排队
							if(isAPP) {
								var queue_id = null;
								var queueDetail_id = null;
								var queueSet_id = null;
								$.each(plus.webview.all(), function(i, v) {
									if(v.id.indexOf("queue_details.html") > 0) {
										queueDetail_id = v.id;
									} else if(v.id.indexOf("queue_set.html") > 0) {
										queueSet_id = v.id;
									} else if(v.id.indexOf("queue_takeNumber.html") > 0) {
										queue_id = v.id;
									}
								});
								//更新排队首页缓存数据
								var queueurl = plus.webview.getWebviewById(queue_id);
								if(queueurl) {
									queueurl.evalJS("webSocketTn()");
								}
								//更新排队详情页缓存数据
								var queueDetailsurl = plus.webview.getWebviewById(queueDetail_id);
								if(queueDetailsurl) {
									queueDetailsurl.evalJS("webSocketDetails()");
								}
								//更新排队设置页缓存数据
								var queueSeturl = plus.webview.getWebviewById(queueSet_id);
								if(queueSeturl) {
									queueSeturl.evalJS("refresh()");
								}
							}
							break;

						default:
							break;
					}
					//		更新数据用

					//更新首页数据使用
					app.freshindex();
					//更新消息列表
					if(isAPP) {
						//更新工作记录缓存数据
						var indexurl = plus.webview.getWebviewById("workRecord.html?" + root);
						if(indexurl) {
							indexurl.evalJS("refreshData()");
						}
						//更新点餐缓存数据
						var orderurl = plus.webview.getWebviewById("tableStatus.html?" + root);
						if(orderurl) {
							orderurl.evalJS("web_s()");
						}
					}
				}

				function transferParameters(id, type) { //监听用户下单并调用
					setItem("canshu", id);
					if(isAPP) {
						var tableurl = plus.webview.getWebviewById("tableStatus.html?" + root);
						if(tableurl) {

							switch(type) {
								case "waiter_by_put_order_2": //下单
									tableurl.evalJS("back_table(1)");
									break;
								case "put_order_confirm": //结账
									tableurl.evalJS("back_table(2)");
									break;
								case "put_order_goods_confirm": //下厨
									tableurl.evalJS("back_table(3)");
									break;
								default:
									break;
							}
						}
					}
				}
			}

			var slider = mui("#slider");
			slider.slider({
				interval: 5000
			});
		</script>
	</body>

</html>
